import { observable, action, toJS } from 'mobx';
import { message, Modal } from 'antd';
import { WeaTools,WeaLoadingGlobal  } from 'ecCom';
import { ListStore } from './listStore'
import { WeaForm, WeaTableNew } from 'comsMobx';
import * as API_LIST from '../apis/inventory';
import * as Common_Apis from '../apis/index'
import { getFormInitDatas } from "../util/index"
const { TableStore } = WeaTableNew;
import { WeaLocaleProvider } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
/**
 * 盘点Store
 */
export default class CptInventoryStore extends ListStore {

    @observable form = new WeaForm();
    @observable mainform = new WeaForm();
    //新增计划
    @observable addVisible = false;
    @observable doPlanVisible = false;
    @observable addform = new WeaForm();
    @observable addformCondition = [];
    @observable addformCheckStr = {};

    //编辑计划
    @observable editVisible = false;
    @observable editform = new WeaForm();
    @observable editformCondition = [];
    @observable editformCheckStr = {};
    //添加列表
    @observable addlistform = new WeaForm();
    @observable addlistVisible = false;
    @observable addlistformCondition = [];
    @observable addlistformCheckStr = {};
    //编辑列表
    @observable editlistform = new WeaForm();
    @observable editlistVisible = false;
    @observable editlistformCondition = [];
    @observable editlistformCheckStr = {};
    //盘点
    @observable inventoryform = new WeaForm();
    @observable inventoryVisible = false;
    @observable inventoryformCondition = [];
    @observable inventoryformCheckStr = {};

    @observable title = "";
    @observable maintitle = "";
    @observable listtitle = "";
    @observable visible = false;
    @observable tabvisible = false;
    @observable visible1 = false;
    @observable basicInfo = [];
    @observable basicInfo1 = [];
    @observable subInfo = {};
    @observable subInfo1 = {};
    @observable canEdit = true;
    @observable canEdit1 = true;
    @observable rightMenu = [];
    @observable canEditlist = true;
    @observable inventorystate = "";

    @observable canEditCpt = true;
    @observable canAddPlan = true;
    @observable isright = true;
    @observable canExcelOut = false;


    @observable subListData = [];
    //@observable subListData1 = [];
    @observable planlistForm = new WeaForm();
    @observable planlistForm1 = new WeaForm();
    @observable paramslist = {};
    @observable paramslist1 = {};
    @observable plantableStore = new TableStore();//盘点表table
    @observable plantableStore1 = new TableStore();//资产table
    @observable plantableStore2 = new TableStore();//资产添加table
    @observable planmaintableStore = new TableStore();//总盘点表table
    
    @observable sessionkey_plan = "";
    @observable sessionkey_planlist = "";
    @observable sessionkey_planlist_add = "";
    @observable planmaindataKey = "";

    @observable addCptVisible = false;
    @observable cptSerchform = new WeaForm();
    @observable planmainform = new WeaForm();
    @observable cptform = new WeaForm();

    @observable selectid = '';
    @observable listid = '';

    @observable baseParams = {};
    @observable searchParams = {
        viewcondition: 0
    };
    @observable searchMainParams = {
        tabkey: "0"
    }
    @observable showMainSearchAd = false;
    @observable showcptSearchAd = false;
    @observable showcptAddSearchAd = true;
    @observable conditionMain = [];
    @observable conditionlistcpt = [];
    @observable conditionSerch = [];

    @observable importVisible = false;
    @observable hasUpload = false;
    @observable spinning = false;
    @observable msg = "";
    @observable reflesh = 0;
    @observable filelist = [];
    @observable excelfile = '';
    @observable remind;

    topTab = [
        { title: getLabel(2121, '详细信息'), key: "0" },
        { title: '盘点总表', key: "1" },
    ];//已切换至页面

    constructor() {
        super();
        this.appendBaseParams = this.appendBaseParams.bind(this);
        this.doSearch = this.doSearch.bind(this);
        this.clearStatus = this.clearStatus.bind(this);
        this.clearStatus_imp = this.clearStatus_imp.bind(this);
        this.initDatas = this.initDatas.bind(this);
        this.initPlanmainDatas = this.initPlanmainDatas.bind(this);
        this.initPlanListCptDatas = this.initPlanListCptDatas.bind(this);
    }

    @action
    appendBaseParams = (params) => {
        this.baseParams = { ...this.baseParams, ...params };
    }

    //批量导入盘点表对话框
    @action
    handleDialog_imp = (bool) => {
        this.importVisible = bool;
        if (!bool) {
            this.clearStatus_imp();
            this.handleDialog(true, this.paramslist, 0);
        }
    }

    //下载盘点表模板
    getExcelTemplate = (params = {}) => {
        window.location = "/cpt/capital/InventoryListExcelToDB.xls?time="+new Date().getTime()     
    }

    //导入盘点表
    doImport = () => {
        let _this = this;
        if(this.excelfile==''){
            this.remind.showError();
            return;
        }else{
            let params = {planid:this.selectid,Excelfile:this.excelfile||''};
            _this.spinning = true;
            API_LIST.inventoryListImp(params).then(data => {
                if(data) {
                    _this.reflesh++;
                    _this.spinning = false;
                    _this.msg = data.msg;
                }
            })
        }
    }
    
    //清除附件上传状态
    clearStatus_imp = () => {
        this.msg = "";
        this.reflesh++;
        this.excelfile="";
        this.filelist=[];
    }

    @action
    doAdd = (params) => {//盘点计划新增
        let _this = this;
        _this.doPlanVisible = true;
        this.addform.validateForm().then( f =>{
            if(f.isValid){
                API_LIST.doInventoryOperation({
                    actionType: "Add",
                    viewScope: "CptInventoryPlan",
                    ..._this.addform.getFormParams(),
                    formType: "CptInventory"
                }).then((data) => {
                    if (data.msgid == 1) {
                        message.error(data.msg);
                    } else {
                        message.success(data.msg);
                        _this.setVisiable(false, 1);
                        _this.doSearch();
                    }
                    _this.doPlanVisible = false;
                });
            }else{
                f.showErrors();
                _this.doPlanVisible = false;
            }
        })
    }

    @action
    doEdit = (params) => {//盘点计划编辑
        let _this = this;
        _this.doPlanVisible = true;
        this.editform.validateForm().then( f =>{
            if(f.isValid){
                API_LIST.doInventoryOperation({
                    actionType: "Edit",
                    viewScope: "CptInventoryPlan",
                    ..._this.editform.getFormParams(),
                    id: this.selectid
                }).then((data) => {
                    if (data.msgid == 1) {
                        message.error(data.msg);
                    } else {
                        message.success(data.msg);
                        _this.setVisiable(false, 2);
                        _this.doSearch();
                    }
                    _this.doPlanVisible = false;
                });
            }else{
                f.showErrors();
                _this.doPlanVisible = false;
            }
        })
    }

    @action
    doAddlist = (params) => {//盘点计划 列表新增
        this.addlistform.validateForm().then( f =>{
            if(f.isValid){
                API_LIST.doInventoryOperation({
                    actionType: "Add",
                    viewScope: "CptInventoryPlanlist",
                    ...this.addlistform.getFormParams(),
                    mainid: this.selectid,
                    formType: "CptInventory"
                }).then((data) => {
                    if (data.msgid == 1) {
                        message.error(data.msg);
                    } else {
                        message.success(data.msg);
                        this.setVisiable(false, 3);
                        this.handleDialog(true, this.paramslist, 0);
                    }
    
                });
            }else{
                f.showErrors();
            }
        })
    }

    @action
    doEditlist = (params) => {//盘点计划 列表编辑
        this.editlistform.validateForm().then( f =>{
            if(f.isValid){
                API_LIST.doInventoryOperation({
                    actionType: "Edit",
                    viewScope: "CptInventoryPlanlist",
                    ...this.editlistform.getFormParams(),
                    formType: "CptInventory",
                    id: this.listid
                }).then((data) => {
                    if (data.msgid == 1) {
                        message.error(data.msg);
                    } else {
                        message.success(data.msg);
                        this.setVisiable(false, 4);
                        this.handleDialog(true, this.paramslist, 0);
                    }
                });
            }else{
                f.showErrors();
            }
        })
    }

    @action
    doStartList = (params) => { //开始盘点
        API_LIST.doInventoryOperation({
            actionType: "start",
            viewScope: "CptInventoryPlanList",
            ids: params
        }).then((data) => {
            message.success(data.msg);
            this.doSearch();
            this.handleDialog(true, this.paramslist, 0);
        });
    }

    @action
    doDeleteList = (params) => { //删除计划列表
        API_LIST.doInventoryOperation({
            actionType: "Del",
            viewScope: "CptInventoryPlanList",
            ids: params
        }).then((data) => {
            message.success(data.msg);
            this.doSearch();
            this.handleDialog(true, this.paramslist, 0);
        });
    }

    @action
    doDeleteCpt = (params) => { //删除计划列表中的资产
        API_LIST.doInventoryOperation({
            actionType: "Del",
            viewScope: "CptInventoryPlanCpt",
            ids: params
        }).then((data) => {
            message.success(data.msg);
            this.handlePlanList(true, this.paramslist1, 0);
            this.doSearch();
            this.handleDialog(true, { id: this.selectid, name: this.maintitle }, 0);
        });
    }

    @action
    doDeleteMainCpt = (params) => { //删除总表中的资产
        API_LIST.doInventoryOperation({
            actionType: "Del",
            viewScope: "CptInventoryPlanCpt",
            ids: params
        }).then((data) => {
            message.success(data.msg);
            this.doSearch();
            this.doPlanMainSearch();
        });
    }

    setSelectId = (params) => {
        this.selectid = params.selectid;
    }
    setListId = (params) => {
        this.listid = params.listid;
    }

    //校验必填字段
    check_form = (type) => {
        let fields = {}
        let checkstr = ""
        if (type == "edit") {
            fields = toJS(this.editform.getFormParams());
            checkstr = toJS(this.editformCheckStr);
        } else if (type == "add") {
            fields = toJS(this.addform.getFormParams());
            checkstr = toJS(this.addformCheckStr);
        } else if (type == "addlist") {
            fields = toJS(this.addlistform.getFormParams());
            checkstr = toJS(this.addlistformCheckStr);
        }
        else if (type == "editlist") {
            fields = toJS(this.editlistform.getFormParams());
            checkstr = toJS(this.editlistformCheckStr);
        }
        let checkitem = checkstr.split(",");
        let i;
        for (i = 0; i < checkitem.length; i++) {
            let checkid = checkitem[i];
            if (checkid) {
                if (!fields[checkid]) {
                    // Modal.warning({
                    //     title: getLabel(15172, '系统提示'),
                    //     content: getLabel(30933, '必填信息不完整!'),
                    // });
                    message.error(getLabel(30933, '必填信息不完整!'));
                    return false;
                }
            }
        }
        return true;
    }

    //设置弹出窗可见性
    setVisiable = (visiable, index) => {
        if (index == 1) {
            this.addform.resetConditionValue();//清除添加表单默认值  
            this.addVisible = visiable
        } else if (index == 2) {
            this.editVisible = visiable
        } else if (index == 3) {
            this.addlistVisible = visiable
        } else if (index == 4) {
            this.editlistVisible = visiable
        } else if (index == 5) {
            if(visiable==false){
                this.cptSerchform = new WeaForm();
                this.plantableStore2 = new TableStore();
            }
            //this.cptSerchform.resetConditionValue();//清除添加表单默认值    
            this.setCptAddSearchAd(true);//保证下次打开时也默认展开高级搜索   
            this.addCptVisible = visiable
        } else if (index == 6) {
            this.inventoryVisible = visiable
        } else if (index == 7) {
            this.visible1 = visiable
        }
    }

    //新建计划 获取表单
    getAddPlanForm = (params = {}) => {
        this.addform = new WeaForm();
        const newParams = { ...params, actionType: "add", viewScope: "CptInventoryPlan" };
        API_LIST.getInventoryForm(newParams).then((data) => {
            this.addformCondition = data.conditioninfo;
            this.addformCheckStr = data.conditioninfo[0].checkstr
            this.addform && this.addform.initFormFields(this.addformCondition);
        });
    }

    //新建计划列表 获取表单
    getAddPlanlistForm = (params = {}) => {
        this.addlistform = new WeaForm();
        const newParams = { ...params, actionType: "add", viewScope: "CptInventoryPlanList" };
        API_LIST.getInventoryForm(newParams).then((data) => {
            this.addlistformCondition = data.conditioninfo;
            this.addlistformCheckStr = data.conditioninfo[0].checkstr
            this.addlistform && this.addlistform.initFormFields(this.addlistformCondition);
        });
    }

    //编辑计划 获取表单
    getEditPlanForm = (params = {}) => {
        this.editform = new WeaForm();
        const newParams = { ...params, actionType: "edit", viewScope: "CptInventoryPlan" };
        API_LIST.getInventoryForm(newParams).then((data) => {
            this.editformCondition = data.conditioninfo;
            this.editformCheckStr = data.conditioninfo[0].checkstr
            this.editform && this.editform.initFormFields(this.editformCondition);
        });
    }

    //编辑计划列表 获取表单
    getEditPlanlistForm = (params = {}) => {
        this.editlistform = new WeaForm();
        this.listid = params.id;
        const newParams = { ...params, actionType: "edit", viewScope: "CptInventoryPlanList" };
        API_LIST.getInventoryForm(newParams).then((data) => {
            this.editlistformCondition = data.conditioninfo;
            this.editlistformCheckStr = data.conditioninfo[0].checkstr
            this.editlistform && this.editlistform.initFormFields(this.editlistformCondition);
        });
    }

    @action
    doDelete = (params) => { //删除计划
        API_LIST.doInventoryOperation({
            actionType: "Del",
            viewScope: "CptInventoryPlan",
            ids: params.id
        }).then((data) => {
            message.success(data.msg);
            this.doSearch();
        });
    }

    @action
    doBatchDelete = (params) => {//批量删除计划
        API_LIST.doInventoryOperation({
            actionType: "Del",
            viewScope: "CptInventoryPlan",
            ids: params.ids
        }).then((data) => {
            message.success(data.msg);
            this.doSearch();
        });
    }

    @action
    handleDialog = (bool, params = {}, operate) => {//打开盘点计划
        this.searchMainParams = { tabkey: 0 };//默认是计划明细
        this.maintitle = params.name;
        this.tabvisible = bool;
        if (bool) {
            let type = { viewtype: "view" }
            if (operate == "0") {
                this.rightMenu = [];
                type.viewtype = "view";
            }
            this.initPlanListInfo({ ...params, ...type });
            this.paramslist = { ...params };
        }
    }

    @action
    handlePlanList = (bool, params = {}, operate) => {//打开盘点表
        this.visible1 = bool;
        this.listtitle = params.name;
        if (bool) {
            let type = { viewtype: "view" };
            this.initPlanListCptInfo({ ...params, ...type });
            this.paramslist1 = { ...params };
        }
    }

    //获取盘点计划列表明细
    initPlanListInfo = (params = {}) => {
        this.planlistForm = new WeaForm();
        this.selectid = params.id;
        this.subListData = [];
        API_LIST.getCptInventoryPlanList(params).then(data => {
            this.basicInfo = data.mainTableInfo;
            this.plantableStore = new TableStore();
            this.plantableStore.getDatas(data.subTableInfo.sessionkey);
            this.sessionkey_plan = data.subTableInfo.sessionkey;
            this.loading = false;
            this.canEditlist = data.mainTableInfo[0].canEdit;
            this.inventorystate = data.mainTableInfo[0].inventorystate;
            //根据高级搜索条件初始化form
            this.planlistForm && !this.planlistForm.isFormInit && this.planlistForm.initFormFields(data.mainTableInfo);
        })
    }

    //获取盘点计划列表资产明细
    initPlanListCptInfo = (params = {}) => {
        const searchParamsAd = this.cptform.getFormParams();
        const newParams = { ...searchParamsAd, ...params };
        this.planlistForm1 = new WeaForm();
        API_LIST.getCptInventoryPlanCptList(newParams).then(data => {
            this.basicInfo1 = data.mainTableInfo;
            this.canEditCpt = data.mainTableInfo[0].canEditCpt;
            this.plantableStore1 = new TableStore();
            this.plantableStore1.getDatas(data.subTableInfo.sessionkey);
            this.sessionkey_planlist = data.subTableInfo.sessionkey;
            this.loading = false;
            //根据高级搜索条件初始化form
            this.planlistForm1 && !this.planlistForm1.isFormInit && this.planlistForm1.initFormFields(data.mainTableInfo);
        })
    }

    //查询并添加资产
    doCptSearch = (params = {}) => {
        const searchParamsAd = this.cptSerchform.getFormParams();
        const newParams = { ...searchParamsAd, ...params };
        this.loading = true;
        API_LIST.searchCptForInventory(newParams).then(data => {
            this.plantableStore2 = new TableStore();
            this.plantableStore2.getDatas(data.sessionkey);
            this.sessionkey_planlist_add = data.sessionkey;
            this.loading = false;
            this.setCptAddSearchAd(false)
            this.doSearch();
        });
    }

    doCptAdd = (params = {}) => {
        const { selectedRowKeys } = this.plantableStore2;
        const newParams = { ...params, ids: toJS(selectedRowKeys), actionType:"select" };
        if(selectedRowKeys.length==0){
            message.error("请选择需要添加的资产！");
        }else{
            API_LIST.addCptToList(newParams).then(data => {
                if (data.success == true) {
                    message.success(getLabel(83476, '添加') + getLabel(15242, "成功"));
                    this.setVisiable(false,5);
                    this.cptform.resetConditionValue(); //添加完资产需要清除盘点表查询条件值
                    this.plantableStore2 = new TableStore();
                    this.handlePlanList(true, { id: this.listid, name: this.listtitle }, 0);
                    this.handleDialog(true, { id: this.selectid, name: this.maintitle }, 0);
                    this.doSearch();
                } else {
                    message.error(getLabel(83476, '添加') + getLabel(498, '失败'));
                }
            });
        }
       
    }

    doCptAddAll = (params = {}) => {
        const searchParamsAd = this.cptSerchform.getFormParams();
        const newParams = { ...searchParamsAd, ...params, actionType:"all" };
        API_LIST.addCptToList(newParams).then(data=>{
            if(data.success==true){
                message.success(getLabel(83476,'添加')+getLabel(15242,"成功"));
                this.setVisiable(false, 5);
               
                this.cptform.resetConditionValue(); //添加完资产需要清除盘点表查询条件值
                this.plantableStore2 = new TableStore();
                this.handlePlanList(true, { id: this.listid,name:this.listtitle }, 0);
                this.handleDialog(true, { id: this.selectid, name: this.maintitle }, 0);
                this.doSearch();
            }else{
                message.error(getLabel(83476,'添加')+getLabel(498,'失败'));
            }
        });
    }

    //盘点计划高级查询表单
    initDatas = (params = {}) => {
        API_LIST.getCptInventoryList({ ...this.baseParams, ...params, viewScope: "CptInventory", actionType: "baseinfo" }).then((data) => {
            const { groupinfo, pagetitle, conditioninfo } = data;
            // this.title = pagetitle;
            this.condition = conditioninfo;
            //根据高级搜索条件初始化form
            this.form && !this.form.isFormInit && this.form.initFormFields(conditioninfo);
        });
        this.searchParams = { ...this.searchParams, ...params };
    }

    //总表高级查询表单
    initPlanmainDatas = (params = {}) => {
        API_LIST.getCptInventoryList({ ...this.baseParams, ...params, viewScope: "PlanMain", actionType: "baseinfo" }).then((data) => {
            const { groupinfo, pagetitle, conditioninfo } = data;
            this.conditionMain = conditioninfo;
            //根据高级搜索条件初始化form
            this.mainform && !this.mainform.isFormInit && this.mainform.initFormFields(conditioninfo);
        });
    }

    //盘点表高级查询表单
    initPlanListCptDatas = (params = {}) => {
        API_LIST.getCptInventoryList({ ...this.baseParams, ...params, viewScope: "PlanlistCpt", actionType: "baseinfo" }).then((data) => {
            const { groupinfo, pagetitle, conditioninfo } = data;
            this.conditionlistcpt = conditioninfo;
            //根据高级搜索条件初始化form
            this.cptform && !this.cptform.isFormInit && this.cptform.initFormFields(conditioninfo);
        });
    }

    //搜索资产页面
    @action
    initInventrorySearchDatas = (params = {}) => {
        this.conditionSerch = [];
        API_LIST.getSearchCondition(params).then(data => {
            this.loading = false;
            this.conditionSerch = data.condition;
            this.conditiontype = { ...this.conditiontype, ...params };
            this.cptSerchform && !this.cptSerchform.isFormInit && this.cptSerchform.initFormFields(data.condition);
        })
    }

    //盘点入口 搜索盘点计划
    doSearch = (params = {}) => {
        //获取表单的参数值
        const searchParamsAd = this.form.getFormParams();
        const newParams = { ...this.baseParams, ...this.searchParams, ...searchParamsAd, ...params, viewScope: "CptInventory", actionType: "splitpage" };
        //this.loading = true;
        API_LIST.getCptInventoryList(newParams).then((data) => {
            this.tableStore = new TableStore();
            this.tableStore.getDatas(data.sessionkey, params.current || 1);
            this.dataKey = data.sessionkey;
            this.canAddPlan = data.canAddPlan;
            this.isright = data.isright;
            this.loading = false;//最后一次必须是修改观察模式的状态，因为前面dataKey及sharearg未设置观察者模式，减少render次数
        });

    }

    //盘点总表搜索
    doPlanMainSearch = (params = {}) => {
        //获取表单的参数值
        const searchParamsAd = this.mainform.getFormParams();
        const newParams = { ...this.baseParams, ...this.searchParams, ...searchParamsAd, ...params, viewScope: "PlanMain", actionType: "splitpage", id: this.selectid };
        this.loading = true;
        API_LIST.getPlanMianList(newParams).then((data) => {
            this.planmaintableStore = new TableStore();
            this.planmaintableStore.getDatas(data.sessionkey, params.current || 1);
            this.planmaindataKey = data.sessionkey;
            this.canExcelOut = data.canExcelOut;
            this.loading = false;//最后一次必须是修改观察模式的状态，因为前面dataKey及sharearg未设置观察者模式，减少render次数
        });

    }
    

    //盘点总表导出
    exportMain = (params = {}) => {
        //获取表单的参数值
        const searchParamsAd = this.mainform.getFormParams();
        const newParams = { ...searchParamsAd, ...params, id: this.selectid };
        API_LIST.exportMain(newParams).then((data) => {
            window.location = "/weaver/weaver.file.ExcelOut";
        });
    }

    //盘点资产 获取表单
    getInventoryForm = (params = {}) => {
        this.inventoryform = new WeaForm();
        const newParams = { ...params, actionType: "edit", viewScope: "CptInventory" };
        API_LIST.getInventoryForm(newParams).then((data) => {
            this.inventoryformCondition = data.conditioninfo;
            this.inventoryformCheckStr = data.conditioninfo[0].checkstr
            this.inventoryform && this.inventoryform.initFormFields(this.inventoryformCondition);
        });
    }

    //设置弹出窗可见性
    setInventoryVisible = (visiable) => {
        this.inventoryVisible = visiable
    }

    //开始盘点  
    startInventory = (params = {}) => {
        WeaLoadingGlobal.start({
            tip: getLabel('127564', '操作中,请稍后...') // 自定义tip文字
          });
        API_LIST.startInventory(params).then(data => {
            WeaLoadingGlobal.end(); // 停止遮罩loading
            WeaLoadingGlobal.destroy(); // 销毁遮罩loading
            if (data == true) {
                message.success(getLabel('83885', '操作成功！'));
            } else {
                message.error(getLabel('384635', "存在空的盘点表,请删除!"));
            }
            this.doSearch();
        });
    }

    //复制盘点  
    copyInventory = (params = {}) => {
        API_LIST.copyInventory(params).then(data => {
            if (data == true) {
                message.success(getLabel('83885', '操作成功！'));
            } else {
                message.error(getLabel('83912', '操作失败！'));
            }
            this.doSearch();
        });
    }

    //强制完成  
    finishInventory = (params = {}) => {
        API_LIST.finishInventory(params).then(data => {
            if (data == true) {
                message.success(getLabel('83885', '操作成功！'));
            } else {
                message.error(getLabel('83912', '操作失败！'));
            }
            this.doSearch();
        });
    }

    

    clearStatus = () => {
        this.searchParams = { viewcondition: 0 };
        this.showSearchAd = false;
        this.clearFormFields();
    }

    @action
    changeTab = (key) => {  //切换页签    
        this.mainform.resetConditionValue(); //清除查询条件值      
        this.searchMainParams = { tabkey: key };
        if (key != 1) {
            this.handleDialog(true, { id: this.selectid, name: this.maintitle }, 0);
        }
    }

    @action
    setMainSearchAd = (bool) => {//设置总表高级查询选项的显隐
        this.showMainSearchAd = bool;
    }

    @action
    clearMainFormFields = () => {
        this.mainform.resetConditionValue(); //清除查询条件值
    }

    @action
    setCptSearchAd = (bool) => {//设置总表高级查询选项的显隐
        this.showcptSearchAd = bool;
    }

    @action
    setCptAddSearchAd = (bool) => {//设置添加资产高级查询选项的显隐
        this.showcptAddSearchAd = bool;
    }

    @action
    clearCptFormFields = () => {
        this.cptform.resetConditionValue(); //清除查询条件值
    }

    @action
    clearCptAddFormFields = () => {
        this.cptSerchform.resetConditionValue(); //清除查询条件值
    }

}
